import { request } from "../../utils/request";
Page({
  /**
   * 页面的初始数据
   */
  data: {
    funList: [],
  },
  toSongDetail(e) {
    let index = e.currentTarget.dataset.index;
    let currentMusic = this.data.funList[index];
    wx.navigateTo({
      url: "/pages/songDetail/songDetail",
      success: function (res) {
        res.eventChannel.emit("detail", { musicData: currentMusic });
      },
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onShow: async function (options) {
    let funListData = await request("/fun");
    this.setData({
      funList: funListData.data,
    });
  },
});
